package cc.rengu.redp.bizimpl.igas.service.impl;

import cc.rengu.redp.bizimpl.igas.domain.PTermKey;
import cc.rengu.redp.bizimpl.igas.dao.PTermKeyMapper;
import cc.rengu.redp.bizimpl.igas.service.IPTermKeyService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author lizk
 */
@Service()
@DS("igas")
public class PTermKeyServiceImpl extends ServiceImpl<PTermKeyMapper, PTermKey> implements IPTermKeyService {

    @Autowired
    private PTermKeyMapper pTermKeyMapper;

    @Override
    public int count(String instId, String mchntNo, String termNo, String s) {
        LambdaQueryWrapper<PTermKey> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PTermKey::getInstId, instId).eq(PTermKey::getMchntNo, mchntNo)
                .eq(PTermKey::getTermNo, termNo).eq(PTermKey::getKeyType, s);
        return this.count(queryWrapper);
    }

    @Override
    public void resetKey(String instId, String mchntNo, String termNo, String keyType) {
        pTermKeyMapper.resetKey(instId, mchntNo, termNo, keyType);
    }
}
